#include <iostream>


const int QueueSize = 10;
class ArrayQueue
{
public:
    ArrayQueue():front(0),rear(0){}
    //入队列
    void Push(const int & element)
    {
       if((rear+1) % QueueSize == front)   //队列满:rear 和 front 差了一个元素位置
       {
            std::cout<<"full"<<std::endl;
            return;
       }
        a[rear++]=element;
        rear %= QueueSize;
    }
    //出队列
    void Pop()
    {
        if(front == rear)
        {
            std::cout<<"队列空"<<std::endl;
            return;
        }
        front++;
        front %= QueueSize;
    }

    int* GetFront()//取队头元素
    {
        if(front == rear)
        {
            std::cout<<"队列空"<<std::endl;
            return nullptr;
        }
        return &a[front];
    }

    bool IsEmpty()
    {
        return front == rear;
    }

private:
    int a[QueueSize];
    int front;//队头指针
    int rear;//队尾指针
};
/*
int main()
{
    ArrayQueue q;
    for(int i=0;i<20;i++)
    {
        q.Push(i+1);
    }

    while(q.IsEmpty()== false)
    {
        std::cout<<*q.GetFront()<<"";
        q.Pop();
    }
    std::cout<<std::endl;

    q.Push(1);
    while(q.IsEmpty()== false)
    {
        std::cout<<*q.GetFront()<<"";
        q.Pop();
    }
    std::cout<<std::endl;


    return 0;
}
*/